package com.aftersale.demo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.mail.internet.MimeMessage;

/**
 * @author 空
 * @date 2023/10/29 22:34
 * @desc
 */
@Component
public class ThreadServiceImpl {
    @Autowired
    JavaMailSender javaMailSender;
    @Async("task")
    public void sendMail(MimeMessage mimeMessage) {
        System.out.println(Thread.currentThread().getName());
        javaMailSender.send(mimeMessage);
    }

}
